package com.bluestone.assertor;

import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

import org.apache.log4j.spi.LoggingEvent;

import com.bluestone.util.Util;

public class AIVRIgnoreFilter implements AssertorFilter{

	List conds = new ArrayList();
	
    public void setFilterCond(String cond){
    	StringTokenizer token = new StringTokenizer(cond,",");
    	while(token.hasMoreTokens()){
    		String temp = token.nextToken();
    		conds.add(temp);
    	}
    }
	
	public boolean doFilter(Object obj) {
		if(String.class.isInstance(obj)){
			String temp = (String)obj;
			for(int i=0; i< conds.size(); i++){
				String cond = (String)conds.get(i);
				StringTokenizer token = new StringTokenizer(cond,"|");
				String nodeValue = temp;
		    	while(token.hasMoreTokens()){
		    		String node = token.nextToken();
		    		nodeValue = Util.getNodeValue(nodeValue, node);
		    	}				
				
			}
			return true;
	    }
		return false;		
	}
	


}
